﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;

namespace Consulta.Controllers
{
    public class AccountController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Index2()
        {
            return View();
        }


        public ActionResult Login(string username, string password)
        {
            if (username != null || password != null)
            {
                if (WebSecurity.Login(username, password, false))
                {
                    if (username == "admin" && password == "admin")
                    {

                        return RedirectToAction("Index", "usuario");

                    }

                    return RedirectToAction("IndexUsuario", "usuario");

                }

                ViewBag.errorUsuario = true;
                return View("Index");
            }

            ViewBag.errorUsuario = true;
            return View("Index");

        }

        public ActionResult Logout()
        {
            WebSecurity.Logout();
            return RedirectToAction("Index");
        }

    }
}
